package com.hq.util;

import com.hq.service.StuService;
import org.aspectj.lang.JoinPoint;
import org.aspectj.lang.annotation.Aspect;
import org.aspectj.lang.annotation.Before;
import org.aspectj.lang.annotation.Pointcut;
import org.springframework.stereotype.Component;

import javax.annotation.Resource;

@Component
@Aspect
public class MyAop {

    @Resource
    private StuService stuService;

    @Pointcut("execution(* com.hq.service.*.*(..))")
    private void  MyAdvice(){
    }


    @Before("MyAdvice()")
    public void before(JoinPoint joinPoint){
        System.out.println("");
        Object[] args = joinPoint.getArgs();
        stuService.addLog(args[0]);// 单表
    }



}
